import { constantRoutes, asyncRouters } from '@/router/index'
const state = {
  router: constantRoutes
}
const mutations = {
  SET_ROUTER(state, paload) {
    // import { constantRoutes } from '@/router/index'
    state.router = [...constantRoutes, ...paload]
  }
}
const actions = {
  setRouter(context, mues) {
    const arrRouter = []
    console.log(mues);
    mues.forEach(key => {
      const router = asyncRouters.filter(item => {
        if ('/' + key === item.path) {
          return true
        }
      })
      arrRouter.push(...router)
    })
    context.commit('SET_ROUTER', arrRouter)
    return arrRouter
  }
}
export default { namespaced: true, state, mutations, actions }
